package com.globallogic.learning.kozius.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * Class contains an array of questions for an examination
 * <p/>
 * Created by sergii.koziumynskyi on 2/6/14.
 */
public final class Ticket {
    public Ticket(List<String> questions) {
        this.questions = questions;
    }

    public int getId() {
        return id;
    }

    public List<String> getQuestions() {
        return questions;
    }

    public void setQuestions(List<String> questions) {
        this.questions = questions;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Ticket ticket = (Ticket) o;

        if (id != ticket.id) return false;
        if (questions != null ? !questions.equals(ticket.questions) : ticket.questions != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = questions != null ? questions.hashCode() : 0;
        result = 31 * result + id;
        return result;
    }

    @Override
    public String toString() {
        return "Ticket{" +
                "questions=" + questions +
                ", id=" + id +
                '}';
    }

    private List<String> questions = new ArrayList<String>();

    private int id;
    private static int nextId = 620000000; // 62 prefix will show that it is a ticket

    {
        id = nextId;
        nextId++;
    }

}
